package com.zx.cloud.job;

import com.zx.cloud.SpringUtils;
import com.zx.cloud.common.mapper.JsonMapper;
import com.zx.cloud.controller.StatusCode;
import com.zx.cloud.controller.client.ProviderClient;
import com.zx.cloud.domain.ScheduleJob;
import com.zx.cloud.model.response.ObjectDataResponse;

public class TaskExcutor {

	public void buildOverdue(ScheduleJob job) throws Exception {
		ProviderClient providerClient=SpringUtils.getBean(ProviderClient.class);
		System.out.println(JsonMapper.nonDefaultMapper().toJson(job));
		System.out.println("----------TaskExcutor.buildOverdue----开始调用--buildOverdue---");
		ObjectDataResponse<Integer> objectDataResponse=providerClient.buildOverdue();
		System.out.println("----------TaskExcutor.buildOverdue----调用完成--响应结果---["+JsonMapper.nonDefaultMapper().toJson(objectDataResponse)+"]");
		if(objectDataResponse.getCode()==StatusCode.OK.code()){
			
		}
	}
	public void withhold(ScheduleJob job) throws Exception {
		ProviderClient providerClient=SpringUtils.getBean(ProviderClient.class);
		System.out.println(JsonMapper.nonDefaultMapper().toJson(job));
		System.out.println("----------TaskExcutor.withhold----开始调用--buildOverdue---");
		ObjectDataResponse<Integer> objectDataResponse=providerClient.withhold();
		System.out.println("----------TaskExcutor.withhold----调用完成--响应结果---["+JsonMapper.nonDefaultMapper().toJson(objectDataResponse)+"]");
		if(objectDataResponse.getCode()==StatusCode.OK.code()){
			
		}
	}
	
	public void taskRepaySendSMS(ScheduleJob job) throws Exception {
		ProviderClient providerClient=SpringUtils.getBean(ProviderClient.class);
		System.out.println(JsonMapper.nonDefaultMapper().toJson(job));
		System.out.println("----------TaskExcutor.withhold----开始调用--buildOverdue---");
		ObjectDataResponse<Integer> objectDataResponse=providerClient.taskRepaySendSMS();
		System.out.println("----------TaskExcutor.withhold----调用完成--响应结果---["+JsonMapper.nonDefaultMapper().toJson(objectDataResponse)+"]");
		if(objectDataResponse.getCode()==StatusCode.OK.code()){
			
		}
	}
	
	public void run2(ScheduleJob job) throws Exception {
		System.out.println("-----TaskExcutor-----run2------------");
	}

	public void run3(ScheduleJob job) throws Exception {
		System.out.println("-----TaskExcutor-----run3------------");
	}

}